﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Script.Serialization;
using System.IO;
using System.Collections;
using System.Xml;
using System.Text.RegularExpressions;

namespace json2objects {
    class Sorter : DynamicJsonConverter {

        public static void Main(String[] args) {

            var serializer = new JavaScriptSerializer();
            serializer.RegisterConverters(new[] { new DynamicJsonConverter() });

            IEnumerable<string> friends = File.ReadLines("../../friends.json");
            IEnumerable<string> limited = File.ReadLines("../../limited.json");

            IEnumerable<string> result = friends.Except<string>(limited);

            foreach (string str in result.Where(n => (n.Contains("name\":")))) {
                foreach (string name in Regex.Split(str, "\"")) {
                    if (name.Contains(" ") && !name.Contains(":") && !name.Contains("  "))
                        Console.WriteLine(name);

                }
            }
            Console.ReadKey();

        }

    }
}
